package com.ibm.cloud.banking.account.route;

import com.ibm.cloud.banking.account.constant.RouteInfo;
import com.ibm.cloud.banking.account.service.IAccountInfoService;
import com.ibm.cloud.banking.facade.media.IMediaCardFacade;

import org.apache.camel.builder.RouteBuilder;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * replace desc in here
 *
 * @author HanDong
 * @date 2022/7/17
 */
@Configuration
public class QueryAccountRoute extends RouteBuilder {

    @Resource
    private IAccountInfoService accountInfoService;

    @Resource
    private IMediaCardFacade mediaCardFacade;

    @Override
    public void configure(){
        from(RouteInfo.QUERY_ACC_INFO.servNo)
                .routeDescription(RouteInfo.QUERY_ACC_INFO.desc)
                .routeId(RouteInfo.QUERY_ACC_INFO.id)
                .log("开始执行账户查询->根据卡号:${body['cardNo']}查询账户")
                //.setBody(ExpressionBuilder.bodyExpression("${body=${body['cardNo']}}"))
                .bean(mediaCardFacade, "getAccountNoByCardNo")
                .bean(accountInfoService, "getAccountInfo");
    }

}